import Layout from '@/layout'

const sysRouter = {
  path: '/sys',
  component: Layout,
  name: 'sys_mgr',
  redirect: '/sys/dict/list',
  meta: { title: '系统管理', icon: 'ljm-tool', permissions: ['sys:auth:role:list', 'sys:auth:permission:list', 'sys:auth:resource:list', 'sys:dict:list'] },
  children: [
    {
      path: 'auth',
      component: () => import('@/views/sys/auth/index'), // Parent router-view
      name: 'auth_mgr',
      meta: { title: '权限控制', icon: 'auth', permissions: ['sys:auth:role:list', 'sys:auth:permission:list', 'sys:auth:resource:list'] },
      redirect: '/sys/auth/role/list',
      children: [
        {
          path: 'role',
          component: () => import('@/views/sys/auth/role/index'),
          name: 'role_mgr',
          meta: { title: '角色管理', permissions: ['sys:auth:role:list'] },
          redirect: 'list',
          children: [
            {
              path: 'list',
              component: () => import('@/views/sys/auth/role/list'),
              name: 'role_mgr_list',
              meta: { title: '角色管理', icon: 'ljm-role', permissions: ['sys:auth:role:list'] }
            },
            {
              path: 'add',
              component: () => import('@/views/sys/auth/role/add'),
              name: 'role_mgr_add',
              meta: { title: '新增角色', permissions: ['sys:auth:role:add'] },
              hidden: true
            },
            {
              path: 'edit',
              component: () => import('@/views/sys/auth/role/edit'),
              name: 'role_mgr_edit',
              meta: { title: '修改角色', permissions: ['sys:auth:role:edit'] },
              hidden: true
            },
            {
              path: 'view',
              component: () => import('@/views/sys/auth/role/view'),
              name: 'role_mgr_view',
              meta: { title: '角色信息', permissions: ['sys:auth:role:view'] },
              hidden: true
            },
            {
              path: 'authorization',
              component: () => import('@/views/sys/auth/role/permission'),
              name: 'role_mgr_permission',
              meta: { title: '授权', permissions: ['sys:auth:role:authorize'] },
              hidden: true
            },
            {
              path: 'userRef',
              component: () => import('@/views/sys/auth/role/userRef'),
              name: 'role_mgr_userRef',
              meta: { title: '指派', permissions: ['sys:auth:role:appoint'] },
              hidden: true
            }
          ]
        },
        {
          path: 'permission',
          component: () => import('@/views/sys/auth/permission/index'),
          name: 'permission_mgr',
          meta: { title: '权限管理', permissions: ['sys:auth:permission:list'] },
          redirect: 'list',
          children: [
            {
              path: 'list',
              component: () => import('@/views/sys/auth/permission/list'),
              name: 'permission_mgr_list',
              meta: { title: '权限管理', icon: 'ljm-permission', permissions: ['sys:auth:permission:list'] }
            },
            {
              path: 'add',
              component: () => import('@/views/sys/auth/permission/add'),
              name: 'permission_mgr_add',
              meta: { title: '新增权限', permissions: ['sys:auth:permission:add'] },
              hidden: true
            },
            {
              path: 'edit',
              component: () => import('@/views/sys/auth/permission/edit'),
              name: 'permission_mgr_edit',
              meta: { title: '修改权限', permissions: ['sys:auth:permission:edit'] },
              hidden: true
            },
            {
              path: 'view',
              component: () => import('@/views/sys/auth/permission/view'),
              name: 'permission_mgr_view',
              meta: { title: '权限信息', permissions: ['sys:auth:permission:view'] },
              hidden: true
            }
          ]
        },
        {
          path: 'resource',
          component: () => import('@/views/sys/auth/resource/index'),
          name: 'resource_mgr',
          meta: { title: '资源管理', icon: 'ljm-resource', permissions: ['sys:auth:resource:list'] },
          redirect: 'list',
          children: [
            {
              path: 'list',
              component: () => import('@/views/sys/auth/resource/list'),
              name: 'resource_mgr_list',
              meta: { title: '资源管理', icon: 'ljm-resource', permissions: ['sys:auth:resource:list'] }
            },
            {
              path: 'add',
              component: () => import('@/views/sys/auth/resource/add'),
              name: 'resource_mgr_add',
              meta: { title: '新增资源', permissions: ['sys:auth:resource:add'] },
              hidden: true
            },
            {
              path: 'edit',
              component: () => import('@/views/sys/auth/resource/edit'),
              name: 'resource_mgr_edit',
              meta: { title: '修改资源', permissions: ['sys:auth:resource:edit'] },
              hidden: true
            },
            {
              path: 'view',
              component: () => import('@/views/sys/auth/permission/view'),
              name: 'resource_mgr_view',
              meta: { title: '资源信息', permissions: ['sys:auth:resource:view'] },
              hidden: true
            }
          ]
        }
      ]
    },
    {
      path: 'dict',
      name: 'dict_mgr',
      component: () => import('@/views/sys/dict/index'),
      meta: { title: '系统字典', icon: 'ljm-dict', permissions: ['sys:dict:list'] },
      redirect: 'list',
      children: [
        {
          path: 'list',
          name: 'dict_mgr_list',
          component: () => import('@/views/sys/dict/list'),
          meta: { title: '系统字典', permissions: ['sys:dict:list'] }
        },
        {
          path: 'add',
          name: 'dict_mgr_add',
          component: () => import('@/views/sys/dict/add'),
          meta: { title: '新建字典', permissions: ['sys:dict:add'] },
          hidden: true
        },
        {
          path: 'edit',
          name: 'dict_mgr_edit',
          component: () => import('@/views/sys/dict/edit'),
          meta: { title: '修改字典', permissions: ['sys:dict:edit'] },
          hidden: true
        },
        {
          path: 'view',
          name: 'dict_mgr_view',
          component: () => import('@/views/sys/dict/view'),
          meta: { title: '字典详情', permissions: ['sys:dict:view'] },
          hidden: true
        },
        {
          path: 'item',
          name: 'dictitem_mgr',
          component: () => import('@/views/sys/dictItem/index'),
          meta: { title: '字典条目', permissions: ['sys:dict:item:list'] },
          redirect: 'list',
          hidden: true,
          children: [
            {
              path: 'list',
              name: 'dictitem_mgr_list',
              component: () => import('@/views/sys/dictItem/list'),
              meta: { title: '字典条目列表', permissions: ['sys:dict:item:list'] },
              hidden: true
            },
            {
              path: 'add',
              name: 'dictitem_mgr_add',
              component: () => import('@/views/sys/dictItem/add'),
              meta: { title: '新增字典条目', permissions: ['sys:dict:item:add'] },
              hidden: true
            },
            {
              path: 'edit',
              name: 'dictitem_mgr_edit',
              component: () => import('@/views/sys/dictItem/edit'),
              meta: { title: '修改字典条目', permissions: ['sys:dict:item:edit'] },
              hidden: true
            },
            {
              path: 'view',
              name: 'dictitem_mgr_view',
              component: () => import('@/views/sys/dictItem/view'),
              meta: { title: '字典条目详情', permissions: ['sys:dict:item:view'] },
              hidden: true
            }
          ]
        }
      ]
    }
  ]
}

export default sysRouter
